package tk.djcrazy.instantmessage.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AuthenticationInterceptor extends AbstractInterceptor {
 	private static final long serialVersionUID = -2979997369966560677L;

	@Override
	public String intercept(ActionInvocation arg0) throws Exception {
 		Map<String, Object> session = arg0.getInvocationContext().getSession();
 		if (session.containsKey("uid")) {
 	  		return arg0.invoke();
		} else {
			return Action.LOGIN;
		}
	}
}
